﻿using System;
using System.Collections.Generic;

namespace Functional
{
    public class ActionMaps
    {
        public static void Map<T>(T[] passMe1, Action<T> mapFunction)
        {
            Int32 L;
            for (L = 0; L < passMe1.Length; L++)
            {
                mapFunction(passMe1[L]);
            }
        }

        public static void Map<T1, T2>(T1[] passMe1, T2 passMe2, Action<T1, T2> mapFunction)
        {
            Int32 L;
            for (L = 0; L < passMe1.Length; L++)
            {
                mapFunction(passMe1[L], passMe2);
            }
        }

        public static void MapTwoArrays<T1, T2>(T1[] passMe1, T2[] passMe2, Action<T1, T2> mapFunction)
        {
            Int32 L;
            for (L = 0; L < passMe1.Length; L++)
            {
                mapFunction(passMe1[L], passMe2[L]);
            }
        }

        public static void Map<T>(List<T> modifyMe, Action<T> function)
        {
            T passT;
            foreach (T t in modifyMe)
            {
                passT = t;
                function(passT);
            }
        }

        public static void Map<T1, T2>(List<T1> passMe1, T2 passMe2, Action<T1, T2> function)
        {
            Int32 L;
            for (L = 0; L < passMe1.Count; L++)
            {
                function(passMe1[L], passMe2);
            }
        }

        public static void MapTwoArrays<T1, T2>(List<T1> passMe1, List<T2> passMe2, Action<T1, T2> function)
        {
            Int32 L;
            for (L = 0; L < passMe1.Count; L++)
            {
                function(passMe1[L], passMe2[L]);
            }
        }
    }
}
